<?php

class Application_Model_DbTable_TheLoaiSach extends Zend_Db_Table_Abstract
{

    protected $_name = 'THELOAISACH';
    
     public function getDataTable($args = array() ){
        $select = $this->select();
        return $select;
    }
    
    public function insertBooktype($args){
        if(is_string($args)){
            $term = array();
            parse_str($args,$term );
            $args = $term;
        }
        $row = $this->createRow($args);
        $row->save();   
        return $this->fetchAll()->toArray();
    }
    
      public function deleteBookType($id){
        $row = $this->find($id)->current();
        if($row){
            return $row->delete();
        }
        return false;
    }
    
    public function getBookType($id){
        return $this->find($id)->current()->toArray();
    }
    
    public function editBookType($args){
        if(is_string($args)){
            $term = array();
            parse_str($args,$term );
            $args = $term;
        }
        $row = $this->find($args['MaTheLoaiSach'])->current();
        foreach($args as $key=>$value){
            $row->{$key} = $value;
        }
        return $row->save();        
    }
}

